gl renderer: Fix linear gradient shader color calculation
authorTimm Bäder <mail@baedert.org>
Sun, 10 Dec 2017 21:27:21 +0000 (22:27 +0100)
committerTimm Bäder <mail@baedert.org>
Thu, 21 Dec 2017 18:12:32 +0000 (19:12 +0100)
This fixes both the wrong headerbar color and the broken border color in
of the circular button in the widget-factory.

gsk/resources/glsl/linear_gradient.fs.glsl

index 2e8450753a689e98af0dc2a2dce8ebd6afcb51b0..0b1f1cc0c17ede4354f93aa0c1149ca82d613861 100644 (file)
@@ -34,7 +34,7 @@ void main() {
   for (int i = 1; i < u_num_color_stops; i ++) {
     if (offset >= u_color_offsets[i - 1])  {
       float o = (offset - u_color_offsets[i - 1]) / (u_color_offsets[i] - u_color_offsets[i - 1]);
-      color = mix(u_color_stops[i - 1], u_color_stops[i], o);
+      color = mix(u_color_stops[i - 1], u_color_stops[i], clamp(o, 0.0, 1.0));
     }
   }